//
//  HomeTableViewCell.m
//  网易Header
//
//  Created by 何欣 on 15/7/2.
//  Copyright (c) 2015年 何欣. All rights reserved.
//

#import "HomeTableViewCell.h"

@interface HomeTableViewCell ()
@property(nonatomic,strong)UIImageView *describeImage;
@property(nonatomic,strong)UILabel *titleLabel;
@property(nonatomic,strong)UILabel *describelLabel;

@end

@implementation HomeTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        _describeImage = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 100  , 100 - 20)];
        _describeImage.backgroundColor = [UIColor blackColor];
        [self.contentView addSubview:_describeImage];

        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(_describeImage.frame.origin.x + _describeImage.frame.size.width + 10, _describeImage.frame.origin.y, [UIScreen mainScreen].bounds.size.width - _describeImage.frame.origin.x - _describeImage.frame.size.width - 10, 30)];
        _titleLabel.textColor = [UIColor blackColor];
        _titleLabel.text = @"这是一个测试的标题";
        [self.contentView addSubview:_titleLabel];
        
        _describelLabel = [[UILabel alloc]initWithFrame:CGRectMake(_titleLabel.frame.origin.x, _titleLabel.frame.origin.y + _titleLabel.frame.size.height, _titleLabel.frame.size.width - 10, 40)];
        _describelLabel.numberOfLines = 2;
        _describelLabel.textColor = [UIColor lightGrayColor];
        _describelLabel.font = [UIFont systemFontOfSize:15.0f];
        _describelLabel.text = @"描述描述描述描述描述描述描述描述描述描述";
        [self.contentView addSubview:_describelLabel];
    }
    return self;
}

-(void)setDataForHomeTableViewCell:(HomeTableViewModel *)model{
    [_describeImage  sd_setImageWithURL:[NSURL URLWithString:model.imgsrc] placeholderImage:[UIImage imageNamed:@""]];
    _titleLabel.text     = model.title ;
    _describelLabel.text = model.digest;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
